home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DJGPP / BCCGRX12.ZIP / contrib / bcc2grx / src / bccgrx01.c < prev    next >
C/C++ Source or Header  |  1993-05-04  |  1KB  |  54 lines

  1. /*
  2.  *  BCC2GRX  -  Interfacing Borland based graphics programs to LIBGRX
  3.  *  Copyright (C) 1993  Hartmut Schirmer
  4.  *
  5.  *  see bccgrx.c for details
  6.  */
  7.  
  8. #include "bccgrx00.h"
  9.  
  10. void bar3d(int left,int top,int right,int bottom,int depth, int topflag)
  11. {
  12.   int yofs, l_d, r_d, t_y, fast, col;
  13.  
  14.   _DO_INIT_CHECK;
  15.   bar(left,top,right,bottom);
  16.  
  17.   left   += VL;
  18.   top    += VT;
  19.   right  += VL;
  20.   bottom += VT;
  21.   if (left > right) SWAP(left,right);
  22.   if (bottom < top) SWAP(bottom,top);
  23.  
  24.   fast = (__gr_lstyle == SOLID_LINE) && (LNE.lno_width == 1);
  25.   LNE.lno_color = col = COL|WR;
  26.   if (fast) GrBox( left, top, right, bottom, col);
  27.        else GrCustomBox( left, top, right, bottom, &LNE);
  28.  
  29.   if (depth == 0) return;
  30.  
  31.   yofs = -depth * getmaxy() / getmaxx();
  32.   r_d = right+depth;
  33.   t_y = top + yofs;
  34.   if (fast) {
  35.     GrLine( right, bottom, r_d, bottom+yofs, col);
  36.     GrVLine(r_d, bottom+yofs, t_y, col);
  37.   } else {
  38.     GrCustomLine( right, bottom, r_d, bottom+yofs, &LNE);
  39.     GrCustomLine( r_d, bottom+yofs, r_d, t_y, &LNE);
  40.   }
  41.   if (topflag) {
  42.     l_d = left+depth;
  43.     if (fast) {
  44.       GrHLine( r_d, l_d, t_y, col);
  45.       GrLine( l_d, t_y, left, top, col);
  46.       GrLine( r_d, t_y, right, top, col);
  47.     } else {
  48.       GrCustomLine( r_d, t_y, l_d, t_y, &LNE);
  49.       GrCustomLine( l_d, t_y, left, top, &LNE);
  50.       GrCustomLine( r_d, t_y, right, top, &LNE);
  51.     }
  52.   }
  53. }
  54.